<template>
	<view>
		<u-navbar leftIconColor="#000" :autoBack="true" :placeholder="false" bgColor="rgba(255,255,255,0.0)">
			<view slot="center" class="nav-title">
				商城详情
			</view>
		</u-navbar>
		<view class="goods-img">
			<u-swiper :autoplay="true" height="300" :indicator="true" indicator-active-color="#000"
				:list="list"></u-swiper>
		</view>
		<view class="content">
			<view class="goods-title">
				{{info.goods_name}}
			</view>
			<view class="tisp">
				<text class="text1">包邮到家</text><text class="text2">·</text><text class="text3">爆品推荐</text>
			</view>
			<view style="height: 30rpx;"></view>
			<view class="goods-price" v-if="info.class_id == 62 || info.class_id == 65 || info.class_id == 66">
				<view class="box">代金券： <text>{{info.price}}</text></view>
				<view class="kucun">库存：<text>{{info.stock}}</text></view>
			</view>
			<view class="goods-price" v-else>
				<view class="box">商品币：<text>{{info.price}}</text></view>
				<view class="kucun">库存：<text>{{info.stock}}</text></view>
			</view>
		</view>
		<view class="content" style="margin-top: 30rpx;">
			<view class="goods-info">
				<image src="../../../static/home/goods-title.png" mode=""></image>
				<text>商品详情</text>
			</view>
			<view style="padding: 20rpx 0; font-size: 26rpx; color: #555;" v-html="info.content"></view>
		</view>
		<view style="height: 120rpx;"></view>
		<view class="bottom">
			<view class="btn">
				<u-button color="rgba(9, 11, 8, 1)" size="large" shape="circle" type="primary" text="立即购买"
					@click="goorder(info)"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				info: {},
				list: []
			}
		},
		onLoad(e) {
			console.log(e, 1111)
			this.id = e.id
			this.goodsinfo()
		},
		methods: {
			goorder(item) {
				uni.navigateTo({
					url: '/pages/shop/order/index?item=' + encodeURIComponent(JSON.stringify(item))
				})
			},
			goodsinfo() {
				let params = {
					id: this.id
				}
				this.$Request({
					method: 'POST',
					url: '/api/Shop/goodsInfo',
					data: params,
					ismsg: false,
				}).then(res => {
					if (res.code == 1) {
						this.info = res.data
						this.list = res.data.lunbo
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background-color: #f8f8f8;
	}
</style>
<style lang="scss" scoped>
	.goods-img {
		image {
			width: 100%;
			height: 600rpx;
		}
	}

	.content {
		padding: 30rpx;
		margin: 0 30rpx;
		background-color: #fff;
		border-radius: 20rpx;

		.goods-info {
			display: flex;
			align-items: center;

			image {
				width: 20px;
				height: 20px;
			}

			text {
				margin-left: 10rpx;
			}
		}

		.goods-title {
			font-size: 36rpx;
			font-weight: bold;
			color: #333333;
		}

		.tisp {
			color: #A26D47;
			font-size: 26rpx;
			margin-top: 10rpx;

			.text1 {
				color: #A26D47;
			}

			.text2 {
				color: #999;
				font-weight: 900;
				padding: 0 5rpx;
			}

			.text3 {
				color: #FF2538;
			}
		}

		.goods-price {
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 26rpx;
			color: #FF4E4E;
			margin-top: 10rpx;

			.box {
				text {
					font-size: 42rpx;
					font-weight: bold;
				}
			}

			.kucun {
				color: #999;

				text {
					color: #000;
				}
			}
		}

		.goods-num {
			display: flex;
			justify-content: space-between;
			align-items: center;
			color: #999999;
			font-size: 24rpx;
			margin-top: 10rpx;
		}

		.title {
			font-size: 32rpx;
			color: #000000;
			font-weight: 500;
			margin-top: 30rpx;
			position: relative;

			.title-img {
				position: absolute;
				bottom: -6rpx;
				left: 0rpx;
				width: 64rpx;
				height: 12rpx;
			}
		}

		.details-img {
			margin-top: 40rpx;

			image {
				width: 100%;
				height: 700rpx;
			}
		}
	}

	.bottom {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		padding: 20rpx 30rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		background-color: #fff;

		.btn {
			width: 90%;
			margin: 0 auto;
		}
	}
</style>